#include<bits/stdc++.h>
using namespace std;
class Bank
{
    private:
        long long number;
        char type;
        double Rate,money;
    public:
        Bank(long long _nu,char _ty,double _mo):number(_nu),type(_ty),money(_mo)
        {
            Rate=0.005;
        }

        void Check()
        {
            cout<<"Account="<<number<<"--";
            if(type=='P')
                cout<<"Person--sum=";
            else
                cout<<"Enterprise--sum=";
            cout<<money<<"--rate="<<Rate<<endl;
        }

        void Cal()
        {
            double ans=0;
            ans=money*Rate+money;
            cout<<"Account="<<number<<"--sum="<<ans<<endl;
        }
        Bank(const Bank& tm)
        {
            number=tm.number+50000000;
            Rate=0.015;
            type=tm.type;
            money=tm.money;
        }
};
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        long long _nu;
        char _ty;
        double _mon;
        cin>>_nu>>_ty>>_mon;
        Bank tmp(_nu,_ty,_mon);
        char do1,do2;
        cin>>do1>>do2;
        if(do1=='C')
        {
            tmp.Cal();
        }
        else
        {
            tmp.Check();
        }
        Bank tmp2(tmp);
        if(do2=='C')
        {
            tmp2.Cal();
        }
        else
        {
            tmp2.Check();
        }
    }
}